package com.reger.canal.core;

import java.util.Map;

import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration;
import org.springframework.messaging.handler.annotation.Payload;

import com.reger.canal.client.CanalClientConfiguration;
import com.reger.canal.server.CanalServerConfiguration;

@SpringBootConfiguration
@ImportAutoConfiguration({ CanalClientConfiguration.class, CanalServerConfiguration.class,RabbitAutoConfiguration.class })
public class SpringBootStarterCanalServerApplication implements CommandLineRunner {
	public static void main(String[] args) {
		SpringApplication.run(SpringBootStarterCanalServerApplication.class, args);
	}

	@Override
	public void run(String... args) throws Exception {
	}

	@RabbitListener(bindings=@QueueBinding(value=@Queue,exchange=@Exchange("REDER.DATEBUS.QUEUE.USER.USER.INSERT")) )
	public void rabbitUserListener (@Payload Map<String,Map<String,Object>> object) {
		System.err.println(object);
	}
	@RabbitListener(bindings=@QueueBinding(value=@Queue,exchange=@Exchange("REDER.DATEBUS.QUEUE.LINKLAWS_TEST.T_S_APP_CHANNEL_DAILY.INSERT")) )
	public void rabbitAppChannelDailyListener (@Payload Map<String,Map<String,Object>> object) {
		System.err.println(object);
	}
//	@RabbitListener(bindings=@QueueBinding(value=@Queue,exchange=@Exchange("REDER.DATEBUS.QUEUE.USER.USER.INSERT")) )
//	public void rabbitListener (@Payload Map<String,Map<String,Object>> object) {
//		System.err.println(object);
//	}
//	@RabbitListener(bindings=@QueueBinding(value=@Queue,exchange=@Exchange("REDER.DATEBUS.QUEUE.USER.USER.INSERT")) )
//	public void rabbitListener (@Payload Map<String,Map<String,Object>> object) {
//		System.err.println(object);
//	}
//	@RabbitListener(bindings=@QueueBinding(value=@Queue,exchange=@Exchange("REDER.DATEBUS.QUEUE.USER.USER.INSERT")) )
//	public void rabbitListener (@Payload Map<String,Map<String,Object>> object) {
//		System.err.println(object);
//	}
//	@RabbitListener(bindings=@QueueBinding(value=@Queue,exchange=@Exchange("REDER.DATEBUS.QUEUE.USER.USER.INSERT")) )
//	public void rabbitListener (@Payload Map<String,Map<String,Object>> object) {
//		System.err.println(object);
//	}
}
